home *** CD-ROM | disk | FTP | other *** search
- ;Open window, public domain
- ;Published with Share-world 5
- ;This version is coded differently with respect to closing the
- ;library and window. It is based on the first in last out method.
- ;This is neater than the 'check if pointer zero' method but can cause
- ;problems when adding new 'openings' latter (eg opening another library)
-
- ;-- Exec --
- Openlib = -552
- Closelib = -414
-
- ;-- Intuition --
- Openwindow = -204
- Closewindow = -72
-
- ;Program
- Start
- move.l 4,a6 ;Get exec lib base
- move.l #iname,a1 ;library name
- move.l #0,d0 ;any version
- jsr Openlib(a6) ;open
- cmp.l #0,d0 ;d0 will be zero if lib no open
- beq noibase ;check for error, if error go to error
- move.l d0,ibase ;store base
- move.l ibase,a6 ;could change to move.l d0,a6
-
- move.l #Window,a0 ;a0 now holds a pointer to the Window
- ;Definition Table
- jsr Openwindow(a6)
-
- cmp.l #0,d0 ;D0 will be zero if the window has failed to open
- beq nowindow ;Did it open?
- move.l d0,windowhd ;Store that handle
-
- bsr delay ;Branch to the delay subroutine
- ;Delays can also be created by using any of
- ;Auckland's public transport
-
- ;The following closing must be done is the opposite order to
- ;how they were opened
-
- move.l ibase,a6 ;It's that ibase character again!
- move.l windowhd,a0 ;Get handle of window (so computer nos what
- ;window to close)
- jsr Closewindow(a6) ;Closing due to renovations
- nowindow
- move.l 4,a6 ;get exec base
- move.l ibase,a1 ;library base for closing
- jsr Closelib(a6) ;Let's close this thing once and for all
- noibase
- moveq #0,d0 ;Extra bit not mention in article, tell Cli no
- ;error, 0 okay, 20 failure
- rts ;exit to CLI, or assembler
- delay
- move.l #0,d0 ;clear d0 (start counting from zero)
- dl1
- add.l #1,d0
- cmp.l #3000000,d0 ;lasts for about 2-3 secs of my A1200
- bne dl1 ;Are we there yet?
- rts ;Yes!
-
- ;variables
- ibase dc.l 0 ;storage for ibase
- windowhd dc.l 0 ;storage for window's handle
-
- ;Window Definition
- Window
- dc.w 10,30 ;x-y position
- dc.w 200,200 ;width-height
- dc.b 1,2 ;colours
- dc.l $200 ;'flags' for messages (next issue!)
- dc.l $100f ;'flags' for appareance (next issue!!)
- ;Change to $1800 for no border!
- dc.l 0,0 ;gadgets, checkmark
- dc.l WinName ;pointer to window name
- dc.l 0 ;screen pointer (don't matter/using workbench)
- dc.l 0 ;No bitmap (for fancy windows only!)
- dc.w 100,100 ;smallest width-height
- dc.w 600,250 ;largest width-height
- dc.w 1 ;workbench window
-
- ;strings
- iname dc.b 'intuition.library',0
- WinName
- dc.b 'My Window likes U2',0 ;Do you?
-
-